import http from '@/api/index'
import type { FlowForm } from '@/api/dataType'
import type { Field } from '@/components/Render/type'
/**
 * 添加流程版本信息
 * @param id
 */
export const addFlowForm = (data:FlowForm) => {
    return http.post<FlowForm>(`/flowForm`,data)
}
/**
 * 修改流程表单版本信息
 * @param id
 */
export const updateFlowForm = (data:FlowForm,type:number) => {
    return http.put<FlowForm>(`/flowForm/` + data.id + "/" + type,data)
}
/**
 * 查询流程版本信息
 * @param id
 */
export const getFlowFormById = (data:string) => {
    return http.get<FlowForm>(`/flowForm/` + data)
}
/**
 * 通过流程信息id查询流程表单版本
 * @param id
 */
export const getFlowFormByFlowInfoId = (data:number) => {
    return http.get<FlowForm>(`/flowForm/search?flowInfoId=` + data)
}
/**
 * 通过流程信息id查询流程表单版本
 * @param id
 */
export const processOnlineForm = (data:number) => {
    return http.get<FlowForm>(`/flowForm/processOnlineForm?flowInfoId=` + data)
}

/**
 * 通过lowflow查询字段
 * @param id
 */
export const getFlowFieldByFlowFormId = (data:string) => {
    return http.get<Field[]>(`/flowForm/lowFlow?flowFormId=` + data)
}
/**
 * 流程版本上线
 * @param id
 */
export const processOnline = (data:FlowForm) => {
    return http.post<FlowForm>(`/flowForm/processOnline`,data)
}
/**
 * 流程版本下线
 * @param id
 */
export const offlineProcess = (data:FlowForm) => {
    return http.post<FlowForm>(`/flowForm/offlineProcess`, data)
}